//
//  Person.m
//  day1-Demo2类的定义
//
//  Created by Maggie on 15/8/1.
//  Copyright (c) 2015年 fmning. All rights reserved.
//
//.m是类的实现文件，或者叫源文件

#import "Person.h"

@implementation Person

#pragma mark - 实现自定义的初始化方法
- (Person *)initWithAge:(int)age andName:(NSString *)name{
    
    //调用父类对象的init方法
    self = [super init];
    
    //nil表示空对象
    if (self != nil) {
        self.age = age;
        self.name = name;
    }
    return self;
}

#pragma mark - 打印个人资料
-(void)print{
    NSLog(@"%@ is %d years old!",self.name,_age);
}

#pragma mark - 和another一起吃
-(void)eatWith:(Person *)another{
    NSLog(@"%@ 和 %@ 一起吃饭...",self.name,another.name);
}

#pragma mark - 和another一起在哪里吃
-(void)eatWith:(Person *)another andWhere:(NSString *)somepalce{
    NSLog(@"%@ 和 %@一起在%@吃饭...",self.name,another.name,somepalce);
}

#pragma mark -
-(void)eatWith:(Person *)another andWhere:(NSString *)somepalce andWhat:(NSString *)something{
     NSLog(@"%@ 和 %@一起在%@吃%@...",self.name,another.name,somepalce,something);
}
@end






